// 当通过MessagePort从主线程发生与worker的连接时，onconnect事件处理程序将触发。(每当有一个和worker发生连接就出发该函数)
onconnect = function(e) {
    var port = e.ports[0];
    console.log('ports');
    console.log(e.ports);
    port.onmessage = function(e) {
      var workerResult = name + 'Result: ' + (e.data[0] * e.data[1]);
      port.postMessage(workerResult);
    };
  };